/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package DAO;

import DTO.CTinhTrang;
import DTO.CFields;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class CTinhTrangDAO extends IData<CTinhTrang>{

    @Override
    public CTinhTrang add(CTinhTrang item) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    protected void add(CTinhTrang item, int t) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void saveBatch() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public int addrows(List<CTinhTrang> list, SubConfig config) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public CTinhTrang Find(CTinhTrang item, List<CTinhTrang> list) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    protected Object OnSubmit(CTinhTrang item, int t, SubConfig config) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Object insertOnSubmit(CTinhTrang item, SubConfig config) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Object updateOnSubmint(CTinhTrang item, SubConfig config) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Object deleteOnSubmint(CTinhTrang item, SubConfig config) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    protected CTinhTrang getItem(ResultSet rs) {
        CTinhTrang item = new CTinhTrang();
        try {
            item.setId(rs.getLong(CFields.id));
            item.setTen(rs.getString(CFields.ten));
        } catch (SQLException ex) {
            Logger.getLogger(CTinhTrangDAO.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        return item;
    }

    @Override
    public List<CTinhTrang> getAll(SubConfig config) {
        String mysql = "select * from " + CFields.tb_tinh_trang ;
        return this.getAll(mysql, config);
    }
    
}
